﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

namespace Arbetsfornedringen.Pages
{
    public partial class Redirect : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var account = Session["Account"] as Account;
            if (account == null)
            {
                Response.Redirect(ResolveClientUrl("~\\Pages\\Login.aspx"));
            }
            else
            {
                switch (account.Authority)
                {
                    case AuthorityLevel.SuperAdmin:
                        Response.Redirect(ResolveClientUrl("~\\Pages\\Admin.aspx"));
                        break;
                    case AuthorityLevel.User:
                        Response.Redirect(ResolveClientUrl("~\\Pages\\User.aspx"));
                        break;
                    case AuthorityLevel.Employer:
                        Response.Redirect(ResolveClientUrl("~\\Pages\\Employer.aspx"));
                        break;
                    case AuthorityLevel.HeadHunter:
                        Response.Redirect(ResolveClientUrl("~\\Pages\\HeadHunter.aspx"));
                        break;
                    default:
                        Response.Redirect(ResolveClientUrl("~\\Pages\\Login.aspx"));
                        break;
                }
            }
            
        }
    }
}